<?php 

require_once('getconfig.php');

Class Model_businesslist extends Dbo_DbManager
 {

	protected $C_BUSINESSINFO;
	protected $N_MEMBERSCOUNT;
	

 	public function __construct($bolCon=TRUE) {
		parent::__construct($bolCon);
	}
	
	public function getBusinessinfo()
	{
		return  $this->C_BUSINESSINFO;
	}
	public function getMemberscount()
	{
		return  $this->N_MEMBERSCOUNT;
	}	

	public function setBusinessinfo($C_BUSINESSINFO)
	{
		$this->C_BUSINESSINFO=$C_BUSINESSINFO;
	}
	public function setMemberscount($N_MEMBERSCOUNT)
	{
		$this->N_MEMBERSCOUNT=$N_MEMBERSCOUNT;
	}	

	public function write()
	{
		$objDbManager = new Dbo_DbManager();
		return $objDbManager->write($this,FALSE);
	}
	public static function delete($intproductid)
	{
		$objDbManager = new Dbo_DbManager();
		return $objDbManager->remove($intproductid,__CLASS__);
	}

	public static function build(array $arrModel_businesslist)
	{
		$objModel_businesslist = new Model_businesslist(FALSE);
		@$objModel_businesslist->setBusinessinfo($arrModel_businesslist['C_BUSINESSINFO']);
		@$objModel_businesslist->setMemberscount($arrModel_businesslist['N_MEMBERSCOUNT']);

		return $objModel_businesslist;
 	 } 	 
    
     public static function get_Businesssublist(){
		$arrRes=array();
		$objDbManager = new Dbo_DbManager ();
		$qry="select * from businesslist order by C_BUSINESSINFO ";
		$arrModel_User=$objDbManager->runquery("$qry");
		if (count( $arrModel_User ) > 0) {
			foreach ( $arrModel_User as $arrNew ) {
				$objUser = self::build ( $arrNew );
				$arrRes [] = $objUser;
			}
		}
		return $arrRes;
	}
	
     public static function get_Businesslist_indivigual($typeofbusiness){
		$arrRes=array();
		$objDbManager = new Dbo_DbManager ();
		$qry="select C_BUSINESSINFO from businesslist where C_TYPE='$typeofbusiness' order by C_BUSINESSINFO";
	//	echo $qry;
		$arrModel_User=$objDbManager->runquery("$qry");
		if (count( $arrModel_User ) > 0) {
			foreach ( $arrModel_User as $arrNew ) {
				$objUser = self::build ( $arrNew );
				$arrRes [] = $objUser;
			}
		}
		return $arrRes;
	}
		
     public static function get_Memberscount($businessinfo){
		$arrRes=array();
		$objDbManager = new Dbo_DbManager ();
		$qry="select N_MEMBERSCOUNT from businesslist where C_BUSINESSINFO='$businessinfo' ";
		$arrModel_User=$objDbManager->runquery("$qry");
		if (count( $arrModel_User ) > 0) {
			foreach ( $arrModel_User as $arrNew ) {
				$objUser = self::build ( $arrNew );
				$arrRes [] = $objUser;
			}
		}
		return $arrRes;
	}	

 }
 ?>